// 统一管理接口地址
import request from "@/request/request.js";
import qs from "qs"
// 定义对应的接口


/*  没改成函数的话，执行api.js时，默认都会请求，改为函数，只有调用了才发送请求
export const JingPingAPI = request.get("/products/recommend") 
*/

// 精品推荐接口
export const JingPingAPI = () => request.get("/products/recommend")
// 热门兑换
export const ReMenAPI = () => request.get("/products/hot")

// 验证码请求
export const SendSMSAPI = (params) => request.post("/sendSMS", qs.stringify(params))
// 手机登录
export const PhoneReginAPI = (params) => request.post("/phoneRegin", qs.stringify(params))
// 微信扫码登录
export const WxLoginAPI = (params) => request.post("/wechatUsers/PCLogin", qs.stringify(params))
// 手机绑定微信
export const BangDingAPI = (params) => request.post("/wechatUsers/binding", qs.stringify(params))
// 获取用户信息
export const userProfilesAPI = () => request.get("/shop/userProfiles")
// 根据id 获取详情页内 /products/90
export const GoodsDetailsAPI = (id) => request.get(`/products/${id}`)

// 加入购物车 
export const CartsAddAPI = (params) => request.post("/shop/carts/add", qs.stringify(params))

// 全部商品 /products
export const GoodsSearchAPI = (params) => request.get("/products", { params })

// 查看购物车 
export const CartsSearchAPI = () => request.get("/shop/carts")

// 购物车删除商品
export const CartsDelAPI = (id) => request.delete(`/shop/carts?productIds=${id}`)